<!-- 活动管理 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10" v-if="!pup">活动管理</p>
    <div>
      <dxtable
        :headBtn="headBtn"
        :dataJson="dataJson"
        :formJson="formJson"
        :portUrl="portUrl"
        :qx="qx"
        ref="databale"
        :hidebj="hidebj"
      ></dxtable>
    </div>
  </div>
</template>
<script lang="ts" setup>
import dxtable from "../../../components/util/dxtable.vue";
import sort from "../../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf, transferTimeYMD } from "../../../util/index";
import { h, ref, reactive } from "vue";
import { NSwitch } from "naive-ui";
const props = defineProps({
  pup: { type: String },
  zfleix:{ type: String },
});
const qx = ref({});
const showModal = ref();
const videourl = ref();
let headBtn = ref([]);
const zdList = ref();
const databale = ref();
const typeli = ref([]);
const hidebj = ref(false);
const initeer = () => {
  databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
// 弹窗公用该列表
let dataJson = reactive([]);
let portUrl = "xjyx/xjyxmanagementActivities";

let formJson = reactive([]);
const getcasetype = async () => {
  const { data }: any = await dxget("xjyx/api/sortList");
  formJson[5].options = data;
  dataJson[3].options = [
    {
      label: "全部",
      value: "",
    },
    ...data,
  ];
  typeli.value = data;
  // ishjwoer.value = true
};
getcasetype();

let pupVal = props.pup;

if (pupVal) {
  hidebj.value = true;
  dataJson = [
    {
      title: "活动名称",
      key: "title",
      search: true, // 是否在搜索栏展示
      ellipsis: {
        tooltip: true,
      },
    },
  ];

  headBtn.value = [
    {
      name: "确认选择 ",
      async clickFun(calld) {
        if (calld.length <= 0) {
          window.$message.error("请在列表中勾选数据");
          return;
        }
        const { data } = await dxpost("xjyx/api/addhuodsse", {
          ids: calld.join(","),
          zfleix:props.zfleix
        });

        emit("callBack");
      },
    },
  ];
  qx.value = {
    DeletePermissionID: "23456", //删除
    EditPermissionIdentifier: "", // 编辑
    NewPermissionIdentifier: "23456", // 新建
    ViewPermissionID: "", // 查看
  };
}
</script>
